"""empty message

Revision ID: a3be5dbc827f
Revises: f167115c7c4a
Create Date: 2025-02-28 14:14:56.100618

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision: str = 'a3be5dbc827f'
down_revision: Union[str, None] = 'f167115c7c4a'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('publisher', 'publisher_url',
               existing_type=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=512),
               type_=sa.String(length=128, collation='utf8mb4_unicode_ci'),
               existing_comment='发布者链接',
               existing_nullable=False)
    op.drop_index('publisher_name', table_name='publisher')
    op.drop_index('publisher_url', table_name='publisher')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index('publisher_url', 'publisher', ['publisher_url'], unique=True)
    op.create_index('publisher_name', 'publisher', ['publisher_name'], unique=True)
    op.alter_column('publisher', 'publisher_url',
               existing_type=sa.String(length=128, collation='utf8mb4_unicode_ci'),
               type_=mysql.VARCHAR(collation='utf8mb4_unicode_ci', length=512),
               existing_comment='发布者链接',
               existing_nullable=False)
    # ### end Alembic commands ###
